<!DOCTYPE html>
<!-- <html xmlns:th="http://www.thymeleaf.org"> -->
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<title></title>
<script type="text/javascript" src="../js/jquery-2.1.1.min.js"></script>
<link rel="stylesheet" href="../js/layui/css/layui.css">
<script src="../js/layui/layui.all.js" type="text/javascript"></script>
<script type="text/javascript" src="../js/WebCalendar.js"></script>
<script type="text/javascript">
	
$(function (){
	checkseach();
	//location.reload();
})
var tabobj;
	function checkseach(){
		//alert(1)
		var name = $("#name").val();
		var btime = $("#btime").val();
		var etime = $("#etime").val();
		var checkzt = $("#checkzt option:selected").val();
		
		 layui.use(['form','layer', 'table'], function(){
			 
			  var laydate = layui.laydate //日期
			  ,layer = layui.layer //弹层
			  ,table = layui.table //表格
			 ,form = layui.form;
			   if( btime !="" && etime != ""){
					  if(btime > etime || btime == etime){
					  	layer.msg("时间区间输入不规范，请重新输入");
					  	return;
					  }
					  	  
				  } 
				//执行渲染
				tabobj =  table.render({
				    elem: '#checktab',//指定原始表格元素选择器（推荐id选择器）
				    toolbar:"#checkdiv"
				    ,url:"selAllUserchecksByWhere"
				    ,method:'post',
				    page:true,
				    where:{
				    	userName : name,
				    	btime : btime,
				    	etime : etime,
				    	checkState : checkzt
				    	
				    }
				   ,width:1700
				    ,height: 715 //容器高度
				    ,cols:  [[ //标题栏
				        {checkbox: true,}
				        ,{field: 'id', title: 'ID', width: 80}
				        ,{field: 'userId', title: '员工ID', width: 80}
				        ,{field: 'userName', title: '员工名', width: 100}
				        ,{field: 'checkState', title: '签到状态', width: 100}
				        ,{field: 'checkInTime', title: '签到时间', width: 140}
				        ,{field: 'isCancel', title: '取消', width:70}
				        ,{field: 'checkOutTime', title: '签退时间', width: 140}
				        ,{fixed: 'right', width:100, title: '操作',align:'center', toolbar: '#barDemo'}
				      ]]
				  });
		 })
		// location.reload()
	}
	
	 layui.use(['form','layer', 'table'], function(){
		 
		  var laydate = layui.laydate //日期
		  ,layer = layui.layer //弹层
		  ,table = layui.table //表格
		 ,form = layui.form;
		//监听工具条
		  table.on('tool(demo)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
		    var data = obj.data //获得当前行数据
		    ,layEvent = obj.event; //获得 lay-event 对应的值
				
		    if(layEvent === 'qt'){
		    	 if(data.checkState=='已签退'){
				 	   layer.msg("用户处于签退状态，无需此操作");
				     }else{
				    	 layer.confirm('确认签退么', function(index){
					    	  layer.close(index);
					 		   $.ajax({
					 			   url:"userCheckOut",
					 			   type:"post",
					 			   data:{
					 				   id:data.id
					 			   },
					 			   dataType:"json",
					 			   success:function(res){
					 				   if(res.success){
					 					  layer.msg(res.message)
					 		    			  tabobj.reload();
					 				   }else{
					 					  layer.msg(res.message)
					 		    			  tabobj.reload();
					 				   }
					 			   }
					 		   })
					      });
				     }
		    }
		  })
	 })
	function shclosebtn(){
		 layer.closeAll();
		 $("#shdiv").hide();
	 }
</script>
<script type="text/html" id="barDemo">
	<a class="layui-btn layui-btn-xs" lay-event="qt">签退</a>
</script>
</head>
<body>
<table id="checktab" lay-filter="demo"></table>
	<div id="checkdiv" style="display: none;">
		<form class="layui-form"  id="seavhform">
			<div class="layui-form-item">
				<!--学生名称、跟踪者、跟踪开始时间、跟踪结束时间、回访情况、跟踪方式  -->
			<label class="layui-form-label">员工姓名</label>
			    <div class="layui-input-inline">
			      <input type="text"  id="name"  autocomplete="off"  placeholder="请输入学生姓名" class="layui-input">
			    </div>
			     <label class="layui-form-label">签到状态</label>
				    		<div class="layui-input-inline">
						      <select id="checkzt"  readonly="readonly">
						         <option value="">请选择</option>
						        <option value="已签到">已签到</option>
						        <option value="已签退">已签退</option>
						       
						      </select>
    						</div>

			   <div class="layui-inline">
				     <label class="layui-form-label">签到时间</label>
					      <div class="layui-input-inline" style="width: 180px;">
					        <input type="text" name="price_min" placeholder="yyyy-MM-dd" onfocus="SelectDate(this,'yyyy-MM-dd')" autocomplete="off" class="layui-input" id="btime">
					      </div>
					      <div class="layui-form-mid">-</div>
					      <div class="layui-input-inline" style="width: 180px;">
					        <input type="text" name="price_max" placeholder="yyyy-MM-dd"  onfocus="SelectDate(this,'yyyy-MM-dd')"  autocomplete="off" class="layui-input" id="etime">
					      </div>
    				<input type="button"  value="检索" class="layui-btn  layui-icon-search"  onclick="checkseach()">
    			</div>
    				 
    			
		</div>

		</form>
	</div>
	
	<!-- 查看窗体  -->
	<!-- <div id="shdiv" style="display: none;">
		<form class="layui-form"  id="shform" lay-filter="shform">
		<div class="layui-form-item">
			    <label class="layui-form-label">学生姓名</label>
			    <div class="layui-input-inline">
			     	 <input type="text" name="studentName" autocomplete="off" readonly="readonly"  class="layui-input">
			 	 </div>
 		 </div>
 		 <div class="layui-form-item">
			    <label class="layui-form-label">回访时间</label>
			    <div class="layui-input-inline">
			     	 <input type="text"  name="followTime" autocomplete="off" readonly="readonly"  class="layui-input">
			 	 </div>
 		 </div>
 		 		<div class="layui-form-item">
			    <label class="layui-form-label">回访情况</label>
			 	 <div class="layui-input-inline">
						    <input type="text"name="followState" autocomplete="off"    readonly="readonly"  class="layui-input">
    						</div>
 		 		</div>
				<div class="layui-form-item">
					    <label class="layui-form-label">跟踪方式</label>
				    		<div class="layui-input-inline">
						   <input type="text" name="followType" autocomplete="off"  readonly="readonly"  class="layui-input">
    						</div>
				</div>
				<div class="layui-form-item">
			    <label class="layui-form-label">下次跟踪时间</label>
			    <div class="layui-input-inline">
			     	<input type="text" name="nextFollowTime" autocomplete="off"  readonly="readonly"  class="layui-input">
			 	 </div>
 		 </div>
 		 	<div class="layui-form-item layui-form-text">
				    <label class="layui-form-label">内容</label>
				    <div class="layui-input-block">
				      <textarea name="content" placeholder="请输入内容" class="layui-textarea"></textarea>
				    </div>
				</div>
		<div class="layui-form-item">
		    <div class="layui-input-block">
		      <input type="button"  value="关闭" class="layui-btn"  onclick="shclosebtn()">
		    </div>
  		</div>
	    </form>
	</div> -->
</body>
</html>